package com.ggs.starbug.config.rabbitmq;

import com.rabbitmq.client.Channel;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.listener.api.ChannelAwareMessageListener;
import org.springframework.context.annotation.Configuration;

/**
 * @Author lianghaohui
 * @Date 2021/12/28 10:08
 * @Description
 */
//@Slf4j
//@Configuration
//public class CustomRabbitMQListener implements ChannelAwareMessageListener {
//
//    private int i = 0;
//
//    @Override
//    public void onMessage(Message message, Channel channel) throws Exception {
//        log.info("进入消费端...");
//        if (i == 0) {
//            log.info("消息:{}", message);
//            log.info("消息确认前");
//            channel.basicAck(message.getMessageProperties().getDeliveryTag(), false);
//            log.info("消息确认后");
//        } else {
//            log.info("消息拒绝前");
//            channel.basicReject(message.getMessageProperties().getDeliveryTag(), false);
//            log.info("消息拒绝后");
//        }
//    }
//
//}
